const timerSize = 20;

function Timer()	// extends Sprite
{
    Sprite.apply(this);
    this.buttonMode = false;
    this.mouseChildren = false;
    this.running = false;
    this.time = 0;

    this.increment = function(){
        if (this.running)
            this.time = this.time + 1;
    }
    
    var t = new TextField();
    t.setTextFormat(Timer.tFormat);
    t.x = timerSize/4; 
    t.y = timerSize/4;
    this.addChild(t,0);
     
    this.redraw = function(){
        var textChild = this.getChildAt(0);  
        textChild.text = "time: " + Math.floor(this.time/10)+"."+(this.time%10);
        textChild.width = t.textWidth; 
        textChild.height = t.textHeight;
    } 
        
    
	
}
Timer.prototype = new Sprite();
Timer.tFormat   = new TextFormat(font, timerSize, black);
